//
//  EXMacros.h
//  Edaox
//
//  Created by cao pan on 7/10/14.
//  Copyright (c) 2014 edaox. All rights reserved.
//

#ifndef Edaox_EXMacros_h
#define Edaox_EXMacros_h

#define Alert(TITLE,MSG) [[[UIAlertView alloc] initWithTitle:(TITLE) \
message:(MSG) \
delegate:nil \
cancelButtonTitle:@"确定" \
otherButtonTitles:nil] show]

#define RELEASE_SAFELY(__POINTER) { [__POINTER release]; __POINTER = nil; }


#define RGBColor16Bit(RGB) [UIColor colorWithRed:((float)((RGB & 0xFF0000) >> 16)) / 255.0 \
green:((float)((RGB & 0xFF00) >> 8)) / 255.0 \
blue:((float)((RGB & 0xFF))) / 255.0 \
alpha:1.0]

#define RGBColor10Bit(r,g,b,p) [UIColor colorWithRed:(CGFloat)(r)/255.0 green:(CGFloat)(g)/255.0 blue:(CGFloat)(b)/255.0 alpha:p]


#ifdef DEBUG
#  define LOG(...) NSLog(__VA_ARGS__)
#  define LOGRECT(r) NSLog(@"(%.1fx%.1f)-(%.1fx%.1f)", r.origin.x, r.origin.y, r.size.width, r.size.height)
#else
#  define LOG(...) ;
#  define LOGRECT(r) ;
#endif


#define IS_IPHONE5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)


#define  IOS7_OR_LATER ( [[[UIDevice currentDevice] systemVersion] compare:@"7.0"] != NSOrderedAscending )
#define  IOS6_OR_LATER ( [[[UIDevice currentDevice] systemVersion] compare:@"6.0"] != NSOrderedAscending )
#define  IOS5_OR_LATER ( [[[UIDevice currentDevice] systemVersion] compare:@"5.0"] != NSOrderedAscending )
#define  IOS4_OR_LATER ( [[[UIDevice currentDevice] systemVersion] compare:@"4.0"] != NSOrderedAscending )



#define PUSH_CONTROLLER(a)  [self.navigationController pushViewController:[[NSClassFromString(a) alloc]initWithNibName:a bundle:nil] animated:YES]


#define NNKEY_NETWORK_REQUEST_START   @"network_request_start"
#define NNKEY_NETWORK_REQUEST_FINISH   @"network_request_finish"

#define SHOULD_SKIP_GUIDE @"should_skip_guide"




#endif
